<template>
  <view v-if="isVisible" class="mask" @click="closeMask">
    <view class="mask-content">
      <slot></slot>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    isVisible: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    closeMask() {
      this.$emit("close");
    },
  },
};
</script>

<style scoped>
.mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.mask-content {
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}
</style>
